package com.xoomworks.rsfr.model;

import java.io.Serializable;
import java.util.Date;

/**
 * The persistent class for the trainingsessions database table.
 */
public class TrainingSession extends BaseEntity implements Serializable {
    private static final long serialVersionUID = 1L;

    private Date createdOn;

    private String location;

    private Date modifiedOn;

    private String sessionDescription;

    private String sessionName;

    // uni-directional many-to-one association to User
    private User createdBy;

    // uni-directional many-to-one association to User
    private User modifiedBy;

    // uni-directional many-to-one association to Company
    private Company company;


    /**
     * Constructor with no fields.
     */
    public TrainingSession() {
    }

    /**
     * Constructor with the specified parameters.
     * @param createdOn Date Represents the data when the resource training session  was created.
     * @param sessionDescription String Represents the body of the training session.
     * @param sessionName String Represents the name of the training session.
     * @param createdBy User Represents the user who created the training session.
     * @param company Company Represent the company.
     */
    public TrainingSession(final Date createdOn, final String sessionDescription, final String sessionName,
            final User createdBy, final Company company) {
        super();
        this.createdOn = createdOn;
        this.sessionDescription = sessionDescription;
        this.sessionName = sessionName;
        this.createdBy = createdBy;
        this.company = company;
    }

    /**
     * Gets the date when the training session was created.
     * @return createdOn Date Represents the date when the training session was created.
     */
    public Date getCreatedOn() {
        return this.createdOn;
    }

    /**
     * Sets the date when the training session was created.
     * @param createdOn Date Which is used to set the createdOn.
     */
    public void setCreatedOn(final Date createdOn) {
        this.createdOn = createdOn;
    }

    /**
     * Gets the location.
     * @return location String Represents the location.
     */
    public String getLocation() {
        return this.location;
    }

    /**
     * Sets the location.
     * @param location String Which is used to set the location.
     */
    public void setLocation(final String location) {
        this.location = location;
    }

    /**
     *Get the date when the training session was modified.
     * @return modifiedOn Date Represents the date when the training session was modified.
     */
    public Date getModifiedOn() {
        return this.modifiedOn;
    }

    /**
     * Sets the date when the training session was modified.
     * @param modifiedOn Date Which is used to set the modifiedOn.
     */
    public void setModifiedOn(final Date modifiedOn) {
        this.modifiedOn = modifiedOn;
    }

    /**
     * Gets the body of description.
     * @return sessionDescription String Represents the body of description.
     */
    public String getSessionDescription() {
        return this.sessionDescription;
    }

    /**
     * Sets the body of description.
     * @param sessionDescription String Which is used to set the sessionDescription.
     */
    public void setSessionDescription(final String sessionDescription) {
        this.sessionDescription = sessionDescription;
    }

    /**
     * Gets the name of the session.
     * @return sessionName String Represents the name of the session.
     */
    public String getSessionName() {
        return this.sessionName;
    }

    /**
     * Sets the name of the session.
     * @param sessionName String Which is used to set the sessionName.
     */
    public void setSessionName(final String sessionName) {
        this.sessionName = sessionName;
    }

    /**
     * Gets the user who created the training session.
     * @return createdBy User Represents the user who created the training session.
     */
    public User getCreatedBy() {
        return this.createdBy;
    }

    /**
     * Sets the user who created the training session.
     * @param createdBy User Which is used to set the createdBy.
     */
    public void setCreatedBy(final User createdBy) {
        this.createdBy = createdBy;
    }

    /**
     * Gets the user who modified the training session.
     * @return modifiedBy User Represents the user who modified the training session.
     */
    public User getModifiedBy() {
        return this.modifiedBy;
    }

    /**
     * Sets the user who modified the training session.
     * @param modifiedBy User Which is used to set the modifiedBy.
     */
    public void setModifiedBy(final User modifiedBy) {
        this.modifiedBy = modifiedBy;
    }

    /**
     * Gets the company.
     * @return company Comany.
     */
    public Company getCompany() {
        return this.company;
    }

    /**
     * Sets the company.
     * @param company Company Which is used to set the company.
     */
    public void setCompany(final Company company) {
        this.company = company;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#hashCode()
     */
    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = (prime * result) + ((location == null) ? 0 : location.hashCode());
        result = (prime * result) + ((sessionDescription == null) ? 0 : sessionDescription.hashCode());
        result = (prime * result) + ((sessionName == null) ? 0 : sessionName.hashCode());
        return result;
    }

    /* (non-Javadoc)
     * @see java.lang.Object#equals(java.lang.Object)
     */
    @Override
    public boolean equals(final Object obj) {
        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        TrainingSession other = (TrainingSession) obj;
        if (location == null) {
            if (other.location != null) {
                return false;
            }
        } else if (!location.equals(other.location)) {
            return false;
        }
        if (sessionDescription == null) {
            if (other.sessionDescription != null) {
                return false;
            }
        } else if (!sessionDescription.equals(other.sessionDescription)) {
            return false;
        }
        if (sessionName == null) {
            if (other.sessionName != null) {
                return false;
            }
        } else if (!sessionName.equals(other.sessionName)) {
            return false;
        }
        return true;
    }

}
